countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.9,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("United States", "Austria", "Germany", "Switzerland")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("sub-national DD Index (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
DD.data$State[DD.data$State=="Argovia"] <- "Aargau"
DD.data$State[DD.data$State=="Soleure"] <- "Solothurn"
DD.data$State[DD.data$State=="Valais"] <- "Wallis"
DD.data$State[DD.data$State=="Grisons"] <- "Graubünden"
DD.data$State[DD.data$State=="Appenzell Outer-Rhodes"] <- "Appenzell In."
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
DD.data$State[DD.data$State=="Argovia"]
DD.data$State[DD.data$State=="Argovia"] <- "Aargau"
levels(DD.data$State)
levels(DD.data$State)[levels(DD.data$State)=="Meckenburg-Vorpommern"]
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
levels(DD.data$State)[levels(DD.data$State)=="Meckenburg-Vorpommern"]
levels(DD.data$State)
levels(DD.data$State)[levels(DD.data$State)=="Argovia"]
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes"] <- "Appenzell In."
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
levels(DD.data$State)
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell In."
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell Aus."
levels(DD.data$State)[levels(DD.data$State)=="Basel-Country"] <- "Basel Landschaft"
levels(DD.data$State)[levels(DD.data$State)=="Lucerne"] <- "Luzern"
levels(DD.data$State)[levels(DD.data$State)=="Basel-City"] <- "Basel Stadt"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Inner-Rhodes "] <- "Appenzell In."
levels(DD.data$State)[levels(DD.data$State)=="Thurgovia"] <- "Thurrgau"
levels(DD.data$State)[levels(DD.data$State)=="Neuchatel"] <- "Neuenburg"
levels(DD.data$State)[levels(DD.data$State)=="Zurich"] <- "Zürich"
levels(DD.data$State)[levels(DD.data$State)=="St Gall"] <- "St. Gallen"
levels(DD.data$State)[levels(DD.data$State)=="Vaud"] <- "Waadt"
levels(DD.data$State)[levels(DD.data$State)=="Geneva"] <- "Genf"
levels(DD.data$State)[levels(DD.data$State)=="Fribourg"] <- "Freiburg"
levels(DD.data$State)[levels(DD.data$State)=="Ticino"] <- "Tessin"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell Aus."
levels(DD.data$State)[levels(DD.data$State)=="Basel-Country"] <- "Basel Landschaft"
levels(DD.data$State)[levels(DD.data$State)=="Lucerne"] <- "Luzern"
levels(DD.data$State)[levels(DD.data$State)=="Basel-City"] <- "Basel Stadt"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Inner-Rhodes "] <- "Appenzell In."
levels(DD.data$State)[levels(DD.data$State)=="Thurgovia"] <- "Thurrgau"
levels(DD.data$State)[levels(DD.data$State)=="Neuchatel"] <- "Neuenburg"
levels(DD.data$State)[levels(DD.data$State)=="Zurich"] <- "Zürich"
levels(DD.data$State)[levels(DD.data$State)=="St Gall"] <- "St. Gallen"
levels(DD.data$State)[levels(DD.data$State)=="Vaud"] <- "Waadt"
levels(DD.data$State)[levels(DD.data$State)=="Geneva"] <- "Genf"
levels(DD.data$State)[levels(DD.data$State)=="Fribourg"] <- "Freiburg"
levels(DD.data$State)[levels(DD.data$State)=="Ticino"] <- "Tessin"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE),heights=c(2,1))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("Subnationaler Index für direkte Demokratie (snDDI)",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell Aus."
levels(DD.data$State)[levels(DD.data$State)=="Basel-Country"] <- "Basel Landschaft"
levels(DD.data$State)[levels(DD.data$State)=="Lucerne"] <- "Luzern"
levels(DD.data$State)[levels(DD.data$State)=="Basel-City"] <- "Basel Stadt"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Inner-Rhodes "] <- "Appenzell In."
levels(DD.data$State)[levels(DD.data$State)=="Thurgovia"] <- "Thurrgau"
levels(DD.data$State)[levels(DD.data$State)=="Neuchatel"] <- "Neuenburg"
levels(DD.data$State)[levels(DD.data$State)=="Zurich"] <- "Zürich"
levels(DD.data$State)[levels(DD.data$State)=="St Gall"] <- "St. Gallen"
levels(DD.data$State)[levels(DD.data$State)=="Vaud"] <- "Waadt"
levels(DD.data$State)[levels(DD.data$State)=="Geneva"] <- "Genf"
levels(DD.data$State)[levels(DD.data$State)=="Fribourg"] <- "Freiburg"
levels(DD.data$State)[levels(DD.data$State)=="Ticino"] <- "Tessin"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE),heights=c(2,1))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("snDDI",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
dev.off()
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell Aus."
levels(DD.data$State)[levels(DD.data$State)=="Basel-Country"] <- "Basel Landschaft"
levels(DD.data$State)[levels(DD.data$State)=="Lucerne"] <- "Luzern"
levels(DD.data$State)[levels(DD.data$State)=="Basel-City"] <- "Basel Stadt"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Inner-Rhodes "] <- "Appenzell In."
levels(DD.data$State)[levels(DD.data$State)=="Thurgovia"] <- "Thurrgau"
levels(DD.data$State)[levels(DD.data$State)=="Neuchatel"] <- "Neuenburg"
levels(DD.data$State)[levels(DD.data$State)=="Zurich"] <- "Zürich"
levels(DD.data$State)[levels(DD.data$State)=="St Gall"] <- "St. Gallen"
levels(DD.data$State)[levels(DD.data$State)=="Vaud"] <- "Waadt"
levels(DD.data$State)[levels(DD.data$State)=="Geneva"] <- "Genf"
levels(DD.data$State)[levels(DD.data$State)=="Fribourg"] <- "Freiburg"
levels(DD.data$State)[levels(DD.data$State)=="Ticino"] <- "Tessin"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE),heights=c(2,1))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("snDDI",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
## Plot for book chapter
# LL, 21.9.2020
# Plot all countries
load("/Users/lleemann/Dropbox/DD Index/Generated Index/IndexUSCHATDE.Rdata")
#### Plots
#colorL <- c("blue","magenta", "purple", "red")
colorL <-rev(RColorBrewer::brewer.pal(4, "PuOr"))[c(4,2,3,1)]
countryL <- c("Vereinigte Staaten von Amerika", "Österreich", "Deutschland", "Schweiz")
DD.data$State[DD.data$State=="Meckenburg-Vorpommern"] <- "Mecklenburg-Vorpommern"
levels(DD.data$State)[levels(DD.data$State)=="Argovia"] <- "Aargau"
levels(DD.data$State)[levels(DD.data$State)=="Soleure"] <- "Solothurn"
levels(DD.data$State)[levels(DD.data$State)=="Valais"] <- "Wallis"
levels(DD.data$State)[levels(DD.data$State)=="Grisons"] <- "Graubünden"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Outer-Rhodes "] <- "Appenzell Aus."
levels(DD.data$State)[levels(DD.data$State)=="Basel-Country"] <- "Basel Landschaft"
levels(DD.data$State)[levels(DD.data$State)=="Lucerne"] <- "Luzern"
levels(DD.data$State)[levels(DD.data$State)=="Basel-City"] <- "Basel Stadt"
levels(DD.data$State)[levels(DD.data$State)=="Appenzell Inner-Rhodes "] <- "Appenzell In."
levels(DD.data$State)[levels(DD.data$State)=="Thurgovia"] <- "Thurrgau"
levels(DD.data$State)[levels(DD.data$State)=="Neuchatel"] <- "Neuenburg"
levels(DD.data$State)[levels(DD.data$State)=="Zurich"] <- "Zürich"
levels(DD.data$State)[levels(DD.data$State)=="St Gall"] <- "St. Gallen"
levels(DD.data$State)[levels(DD.data$State)=="Vaud"] <- "Waadt"
levels(DD.data$State)[levels(DD.data$State)=="Geneva"] <- "Genf"
levels(DD.data$State)[levels(DD.data$State)=="Fribourg"] <- "Freiburg"
levels(DD.data$State)[levels(DD.data$State)=="Ticino"] <- "Tessin"
par(mfrow=c(4,1), family="CMU Serif",xpd=TRUE)
layout(matrix(c(1,1,4,4,3,2), 2,3, byrow = FALSE),heights=c(2,1))
for (i in c("US","AT","DE", "CH")){
data.pl <- DD.data[DD.data$country==i,]
orderL <- order(data.pl$Average)
plot(data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
yaxt = "n",
xlab=paste("snDDI",
countryL[which(i==c("US","AT","DE", "CH"))]),
pch=20,
col=colorL[which(i==c("US","AT","DE", "CH"))],
ylab=" ", xlim=c(-0.1,2.1),
bty="n", xpd= TRUE, cex=1.5)
segments(0,seq(0,3,length.out=length(data.pl$Average)),
data.pl$Average[orderL],
seq(0,3,length.out=length(data.pl$Average)),
col=colorL[which(i==c("US","AT","DE", "CH"))],
lwd=8)
text(data.pl$Average[orderL]+0.05,
seq(0,3,length.out=length(data.pl$Average)),
data.pl$State[orderL],
cex=1.5,pos = 4,
col="black")
}
screen.text <- Sys.info()[8]
user.tick <- grepl(screen.text, "lleemann", fixed=TRUE)
if (user.tick) LL <- 1
if (!user.tick) LL <- 0
if (LL==0) setwd("C:/Users/acer/Dropbox/DD Index")
if (LL==1) setwd("~/Dropbox/DD Index")
# load index data
load("./Generated Index/IndexUSCHATDE.Rdata")
setwd("C:/Users/stadelmann/Dropbox/DD Index/Code/Final Code")
# load index data
load("./Generated Index/IndexUSCHATDE.Rdata")
# load individual data
#dataUS <- read.dta("Daten US/ICPSR_35157-1/DS0001/35157-0001-Data.dta",convert.factors = FALSE)
dataUS <- read.dta("Daten US/ANES16/anes_timeseries_2016_dta/anes_timeseries_2016_Stata12.dta", convert.factors = FALSE)
library(xtable)
library(foreign)
library(haven)
library(readxl)
library(arm)
# load individual data
#dataUS <- read.dta("Daten US/ICPSR_35157-1/DS0001/35157-0001-Data.dta",convert.factors = FALSE)
dataUS <- read.dta("Daten US/ANES16/anes_timeseries_2016_dta/anes_timeseries_2016_Stata12.dta", convert.factors = FALSE)
dataUS <- read.dta("C:/Users/stadelmann/Dropbox/DD Index/Daten US/ANES16/anes_timeseries_2016_dta/anes_timeseries_2016_Stata12.dta", convert.factors = FALSE)
dataUS$satisfactionD <- dataUS$V162290
dataUS$satisfactionD[dataUS$satisfactionD< -5] <- NA
dataUS$satisfactionD[dataUS$satisfactionD==4]<- 3
dataUS$satisfactionD[dataUS$satisfactionD==5]<- 4
dataUS$satisfactionD <- abs(dataUS$satisfactionD-5)
table(dataUS$satisfactionD) # high values, high satisfaction
